package cn.b.sky.mes.cm.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import cn.b.sky.common.model.ImeCommon;
import cn.b.sky.user.SecurityContextUtil;

public class ProcessOperation extends ImeCommon implements Serializable {

  /** 
  * @Fields serialVersionUID : 唯一标识
  * @creator     :lidapeng
  */
  private static final long serialVersionUID = -1674965696883734779L;

  /**
   * 主键
   */
  private Integer id;

  /**
   * 工艺编号
   */
  private String processCode;

  /**
   * 工艺版本
   */
  private String processRev;

  /**
   * 工序编号
   */
  private String operationCode;

  /**
   * 工序描述
   */
  private String operationText;

  /**
    *工序类型 ： 生产，质量 
    */
  private String operationTypeEcode;

  /**
     *工序类型 描述： 生产，质量 
     */
  private String operationTypeText;

  /**
   * 工序序号
   */
  private Integer operationOrdinal;

  /**
   * 作业单元类型编号
   */
  private String workUnitTypeCode;

  /**
   * 作业单元类型描述
   */
  private String typeText;

  /**
   * 确认点标志
   * 默认为0 不勾选
   */
  private Integer confirmFlag = 0;

  /**
   * 备注
   */
  private String memo;

  //以下属性新增的，质量工序的属性
  private String collectModeEcode;

  /**
   * 清单采集标志
   */
  private Integer textcollectFlag = 0;

  /**
   * 图形采集标志 
   */
  private Integer graphcollectFlag = 0;
  
  /**
   * 标准产能
   */
  private Integer standardCapacity;

  /**
   * 标准用时
   */
  private Integer standardHours;


  private List<ProcessAttachment> attachment = new ArrayList<ProcessAttachment>();

  private List<ProcessComponent> component = new ArrayList<ProcessComponent>();

  private List<ProcessInspectPicture> picture = new ArrayList<ProcessInspectPicture>();
  
  private List<ProcessCapacity> capacity = new ArrayList<ProcessCapacity>();

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public String getProcessCode() {
    return processCode;
  }

  public void setProcessCode(String processCode) {
    this.processCode = processCode;
  }

  public String getProcessRev() {
    return processRev;
  }

  public void setProcessRev(String processRev) {
    this.processRev = processRev;
  }

  public String getOperationCode() {
    return operationCode;
  }

  public void setOperationCode(String operationCode) {
    this.operationCode = operationCode;
  }

  public Integer getOperationOrdinal() {
    return operationOrdinal;
  }

  public void setOperationOrdinal(Integer operationOrdinal) {
    this.operationOrdinal = operationOrdinal;
  }

  public String getWorkUnitTypeCode() {
    return workUnitTypeCode;
  }

  public String getOperationTypeText() {
    return operationTypeText;
  }

  public void setOperationTypeText(String operationTypeText) {
    this.operationTypeText = operationTypeText;
  }

  public void setWorkUnitTypeCode(String workUnitTypeCode) {
    this.workUnitTypeCode = workUnitTypeCode;
  }

  public String getOperationText() {
    return operationText;
  }

  public void setOperationText(String operationText) {
    this.operationText = operationText;
  }

  public String getOperationTypeEcode() {
    return operationTypeEcode;
  }

  public void setOperationTypeEcode(String operationTypeEcode) {
    this.operationTypeEcode = operationTypeEcode;
  }

  public String getTypeText() {
    return typeText;
  }

  public void setTypeText(String typeText) {
    this.typeText = typeText;
  }

  public Integer getConfirmFlag() {
    return confirmFlag;
  }

  public void setConfirmFlag(Integer confirmFlag) {
    this.confirmFlag = confirmFlag;
  }

  public String getMemo() {
    return memo;
  }

  public void setMemo(String memo) {
    this.memo = memo;
  }

  public String getCollectModeEcode() {
    return collectModeEcode;
  }

  public void setCollectModeEcode(String collectModeEcode) {
    this.collectModeEcode = collectModeEcode;
  }

  //默认0
  public Integer getTextcollectFlag() {
    return textcollectFlag;
  }

  public void setTextcollectFlag(Integer textcollectFlag) {
    this.textcollectFlag = textcollectFlag;
  }

  //默认0
  public Integer getGraphcollectFlag() {
    return graphcollectFlag;
  }

  public void setGraphcollectFlag(Integer graphcollectFlag) {
    this.graphcollectFlag = graphcollectFlag;
  }

  public List<ProcessAttachment> getAttachment() {
    return attachment;
  }

  public void setAttachment(List<ProcessAttachment> attachment) {
    this.attachment = attachment;
  }

  public List<ProcessComponent> getComponent() {
    return component;
  }

  public void setComponent(List<ProcessComponent> component) {
    this.component = component;
  }

  public List<ProcessInspectPicture> getPicture() {
    return picture;
  }

  public void setPicture(List<ProcessInspectPicture> picture) {
    this.picture = picture;
  }

  public List<ProcessCapacity> getCapacity() {
    return capacity;
  }

  public void setCapacity(List<ProcessCapacity> capacity) {
    this.capacity = capacity;
  }

  @Override
  public String getSiteCode() {
    String siteCode = super.getSiteCode();
    if (StringUtils.isBlank(siteCode)) {
      siteCode = SecurityContextUtil.getSiteCode();
    }
    return siteCode;
  }

  public Integer getStandardCapacity() {
    return standardCapacity;
  }

  public void setStandardCapacity(Integer standardCapacity) {
    this.standardCapacity = standardCapacity;
  }

  public Integer getStandardHours() {
    return standardHours;
  }

  public void setStandardHours(Integer standardHours) {
    this.standardHours = standardHours;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    return result;
  }

  /**
   * 重新equals 方法id相同就是同一个对象
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    ProcessOperation other = (ProcessOperation) obj;
    if (id == null) {
      if (other.id != null) {
        return false;
      }
    } else if (!id.equals(other.id)) {
      return false;
    }
    return true;
  }
}
